home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9402 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: isonews.bbn.hp.com!hpbblb!news
  2. From: Matthias Dittrich <matti>
  3. Newsgroups: gwu.seas,comp.lang.c
  4. Subject: Re: help: gcc
  5. Date: 11 Mar 1996 07:36:00 GMT
  6. Organization: Hewlett-Packard Co.
  7. Message-ID: <4i0l50$js0@hpbblb.bbn.hp.com>
  8. References: <4hpiht$1n2@cronkite.seas.gwu.edu>
  9. NNTP-Posting-Host: trabant.bbn.hp.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.07 9000/712)
  14. X-URL: news:4hpiht$1n2@cronkite.seas.gwu.edu
  15.  
  16. spiffy@seas.gwu.edu (Marc Goldberg) wrote:
  17. >
  18. >Trying to compile a program on Solaris 2.5, I've removed all bugs (syntax 
  19. >errors, at least) but these.  Any help would be *greatly* appreciated.
  20. >
  21. >Thanks,
  22. >--Marc
  23. >
  24. >~~~~~
  25. >spiffy@felix:5: gcc 2FarmCheck.c 
  26. >2FarmCheck.c: In function `readHostFiles':
  27. >2FarmCheck.c:23: dereferencing pointer to incomplete type
  28. >2FarmCheck.c:25: dereferencing pointer to incomplete type
  29. >2FarmCheck.c:27: warning: passing arg 3 of `fgets' from incompatible 
  30. >         pointer type
  31. >2FarmCheck.c: In function `main':
  32. >2FarmCheck.c:66: storage size of `PID' isn't known
  33. >~~~~~~
  34. >
  35. >The lines referred to are:
  36. >
  37. >char *readHostFiles(char *name)
  38. >      {
  39. >      int foo;
  40. >      struct FILE *fileDisc;
  41. >
  42. >(23)  *fileDisc = fopen("/users/spiffy/urls.txt", O_RDONLY);
  43. >
  44. >(25)  while (!feof(fileDisc))
  45. >        {
  46. >(27)      if ( fgets(name, HOSTNAMESIZE, fileDisc) != name)
  47. >          exit(12);
  48. >        }
  49. >      return name; 
  50. >      } 
  51. >|
  52. >|
  53. >|
  54. >int main(void)
  55. >      {
  56. >(66)  struct pid_t PID;
  57. >      char name[HOSTNAMESIZE];        /*Hostname of server to check on*/
  58. >
  59. >      PID = getpid();
  60. >      ...other stuff...
  61. >      }
  62. You have to include the header files which are defining the missung types and
  63. functions. These should be stdio.h for file handling and sys/unistd.h for
  64. getpid() and pid_t.
  65.  
  66. Good luck,
  67. Matthias
  68.  
  69.